package com.hazardSoft.eStore.ejb;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import com.hazardSoft.eStore.bussines.ListBO;
import com.hazardSoft.eStore.common.exception.SystemException;
import com.hazardSoft.eStore.entities.Brand;
import com.hazardSoft.eStore.entities.Category;
import com.hazardSoft.eStore.entities.City;
import com.hazardSoft.eStore.entities.Department;
import com.hazardSoft.eStore.entities.OfferType;
import com.hazardSoft.eStore.entities.Role;
import com.hazardSoft.eStore.interfaces.ListLocal;

/**
 * Session Bean implementation class ListEJB
 */
@Stateless
public class ListEJB implements ListLocal {

public static final String EJB_NAME = ListEJB.class.getSimpleName()+"Local";
	
	@PersistenceContext(unitName = "EStoreJPA")
	private EntityManager entityManager;
	private ListBO listBO;
	
    /**
     * Default constructor. 
     */
    public ListEJB() {
    	listBO = new ListBO();
    }

    @Override
    public List<Category> listCategories() throws SystemException {
		return listBO.listCategories(entityManager);
    }

	@Override
	public List<Department> listDepartments() throws SystemException {
		return listBO.listDepartments(entityManager);
	}

	@Override
	public List<City> listCities()throws SystemException {		
		return listBO.listCities(entityManager);
	}

	@Override
	public List<City> listCitiesByDepartment(Department department) throws SystemException {		
		return listBO.listCitiesByDepartment(department, entityManager);
	}

	@Override
	public List<OfferType> listOfferTypes()throws SystemException {
		return listBO.listOfferTypes(entityManager);
	}

	@Override
	public List<Role> listRoles()throws SystemException {
		return listBO.listRoles(entityManager);
	}

	@Override
	public List<Brand> listBrands() throws SystemException {
		
		return listBO.listBrands(entityManager);
	}

}
